Machine learning
Setup the environment if this is executed on Google Colab.
Make sure to change the runtime type to GPU. To do this go to Runtime -> Change runtime type -> GPU
Otherwise, rendering won't work in Google Colab.
import os
try:
import google.colab
IN_COLAB = True
except:
IN_COLAB = False
if IN_COLAB:
os.system("pip install --quiet 'ring @ git+https://github.com/SimiPixel/ring'")
os.system("pip install --quiet mediapy")
import ring
# automatically detects colab or not
ring.utils.setup_colab_env()
import mediapy
import jax.numpy as jnp
import tree_utils
from ring import exp, sim2real, ml
imtp = exp.IMTP(["seg2", "seg3", "seg4"], sparse=True, joint_axes=True)
exp_id = "S_04"
motion = "thomas_fast"
ringnet = ml.RING_ICML24()
errors, X, y, yhat, xs, xs_noimu = exp.benchmark_fn(imtp, exp_id, motion, ringnet, warmup=5.0)
sys = imtp.sys(exp_id)
frames = sys.render_prediction(xs, yhat, stepframe=4, transparent_segment_to_root=False, width=640, height=480, camera="c",
add_cameras={-1: '<camera mode="targetbody" name="c" pos=".5 -.5 1.25" target="3"></camera>',})
errors
mediapy.show_video(frames, fps=25.0)